https://isocpp.org/wiki/faq/mixing-c-and-cpp
In .h
header add
#ifdef __cplusplus
extern "C" {
#endif
#ifdef __cplusplus
}
#endif
Or if you do not want to touch the header file, wrap the include in your cpp
extern "C" {
#include "my_c_header.h"
}
In .hpp
header use
#ifdef __cplusplus
extern "C" {
#endif
void myfunc();
#ifdef __cplusplus
}
#endif
In .cpp
extern "C" void myfunc() {
//foo();
}